﻿
using LineOfBusiness.Controls.Base;
using LineOfBusiness.DataAccess;
using LineOfBusiness.Poco;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace LineOfBusiness.AD.Controllers
{
    public class FunctionListController : LOBController
    {
        public FunctionListController()
        {
            this.GridViewName = "grvFunctionList";
        }

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Save(SYS_FunctionList function)
        {
            if (function.ParentID == null) function.ParentID = "";
            if (function.DisplayMode == null) function.DisplayMode = "";

            using (EFDALContainer dal = new EFDALContainer())
            {
                try
                {
                    dal.Repository.Update(function);
                    dal.UnitOfWork.SaveChanges();
                }
                catch (Exception exp)
                {
                    return Json(exp.Message);
                }
                return Json("0");
            }
        }

    }
}
